import request from '@/utils/request'
export function getallemployee(data) {
  return request({
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/searchAll/v3',
    method: 'post',
    data
  })
}

export function addemployee(data) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/save/v1',
    method: 'post',
    data
  })
}

export function updateemployee(data) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/updateSensitive/v1',
    method: 'post',
    data
  })
}

export function removeemployee(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/deleteById/v1',
    method: 'post',
    data: data
  })
}

// basicemployee/workarrange ‘人员排班’页面
export function getallemployeeduties(data) {
  return request({
    url: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/search/v1',
    method: 'post',
    data: data
  })
}

export function getallleave(data) {
  return request({
    url: '/api/uf/pro/resource/employeecalendar/EmployeeCalendarRest/search/v1',
    method: 'post',
    data
  })
}

export function addleave(data) {
  return request({
    url: '/api/uf/pro/resource/employeecalendar/EmployeeCalendarRest/save/v1',
    method: 'post',
    data
  })
}

export function removeleave(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/uf/pro/resource/employeecalendar/EmployeeCalendarRest/deleteById/v1',
    method: 'post',
    data: data
  })
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl, 人员排班页: basicemployee/workarrange
// 获取人员列表
function getEmployee(reqdata) {
  return request.post(employee.list, reqdata)
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 新增人员
function addEmployee(data) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/saveAll/v1',
    method: 'post',
    data
  })
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 编辑修改人员信息
export function editEmployeeWithFile(data) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/updateAll/v1',
    method: 'post',
    data
  })
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 编辑修改人员信息
function editEmployee(data) {
  return request.post('/api/uf/pro/resource/employeebasic/EmployeeBasicRest/updateSensitive/v1', data)
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 删除人员
function deleteEmployee(reqdata) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/deleteByEmployeeId/v1',
    method: 'post',
    data: reqdata
  })
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 逻辑删除删除人员
export function deleteEmployeeTombstone(reqdata) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/deleteAll/v1',
    method: 'post',
    data: reqdata
  })
}

// created by lx
// 人员信息管理页: basicemployee/employeectrl
// 获取'证书名称'列表
function getCertify(reqdata) {
  return request.post(employee.certify, reqdata)
}

// created by lx
// 人员排班页: basicemployee/workarrange
// 获取排班记录列表
function getWorkarrange(reqdata) {
  return request.post(workarrange.list, reqdata)
}

// created by lx
// 人员排班页: basicemployee/workarrange
// 增加多条排班记录
function addWorkarrange(reqdata) {
  return request.post(workarrange.add, reqdata)
}

// created by lx
// 人员排班页: basicemployee/workarrange
// 修改一条排班记录
function editWorkarrange(reqdata) {
  return request.post(workarrange.edit, reqdata)
}

// created by lx
// 人员排班页: basicemployee/workarrange
// 删除一条排班记录
function deleteWorkarrange(reqdata) {
  return request.post(workarrange.delete, reqdata)
}

// 人员排班
// 新增排班
export function addArrangement(data) {
  return request.post('/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/saveList/v1', data)
}

// 人员排班
// 修改排班记录
export function updateArrangement(data) {
  return request.post('/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/updateSensitive/v1', data)
}

// 人员排班
// 删除排班记录
export function deleteArrangement(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/deleteById/v1',
    method: 'post',
    data: data
  })
}

// 人员信息管理页: basicemployee/employeectrl
/* 改为uf（永峰）分支专用接口 */
/* <!--updated by ljx--><!--2021/09/18-->*/
const employee = {
  list: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/searchAll/v3',
  add: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/saveAll/v1',
  edit: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/updateAll/v1',
  delete: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/deleteByEmployeeId/v1',
  certify: '/api/uf/pro/resource/employcertificatechild/EmployCertificateChildRest/search/v1'
  // list: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/searchAll/v3',
  // add: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/saveAll/v1',
  // edit: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/updateAll/v1',
  // delete: '/api/uf/pro/resource/employeebasic/EmployeeBasicRest/deleteByEmployeeId/v1',
  // certify: '/api/uf/pro/resource/employcertificatechild/EmployCertificateChildRest/search/v1'
}

// 人员排班页: basicemployee/workarrange
const workarrange = {
  list: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/search/v1',
  add: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/saveAll/v1',
  edit: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/updateAll/v1',
  delete: '/api/uf/pro/resource/employeeschedule/EmployeeScheduleRest/deleteByEmployeeScheduleId/v1'
}

export { getEmployee, addEmployee, editEmployee, deleteEmployee, getCertify,
  getWorkarrange, editWorkarrange, addWorkarrange, deleteWorkarrange }
